home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / icons / clrbut.zip / CLRBUTTN.DOC next >
Text File  |  1991-01-21  |  7KB  |  183 lines

  1. Copyright 1991, Dennis Cook        (Compuserve [76467,310])
  2.                 Professional Development Svcs
  3.                 P.O. Box 794
  4.                 Boston, MA  02199
  5.  
  6.                 (617) 974-4037
  7.  
  8.  
  9. This is a user supported product.  It is not public domain, and it is
  10. not free software.  You are granted a limited license to use this
  11. product on a trial basis.  If you wish to continue using the product
  12. after the trial period, you must registar by sending $25. 
  13.  
  14. For support I may be contacted via Compuserve MAIL, or telephone.   
  15. I have a similar control developed that supports the ProtoView
  16. Development Tool (Version 3).  If you need this control, check for the 
  17. file CRBUTTON.ZIP on the ProtoView BBS.
  18.  
  19.  
  20. Contents of CLRBUT.ZIP FILE
  21.  
  22.      CLRBUTTN.DOC  - this document
  23.      CLRBUTTN.H    - header file for your applications
  24.      DEMO.EXE      - Demo program for ColorButtons
  25.      DEMO.ZIP      - zip file containing demo program source
  26.      PDSCNTL.DLL   - DLL for ColorButton support
  27.      PDSCNTL.ZIP   - zip file containing program source for DLL
  28.  
  29.  
  30. ColorButton Controls!!!!
  31.  
  32. Did you ever wish for an easy way to change the color of a push button style
  33. control!   Yeah me too.  Well here is the answer to your prayers, Yuk, Yuk!
  34.  
  35. Actually, you have more than color control with ColorButtons.  You can also
  36. have multiple line labels and font selection.
  37.  
  38.  
  39. The dynamic link library, PDSCNTL.DLL, contains the custom control procedure 
  40. for ColorButton.  It will also support the Dialog Editor and a
  41. version for ProtoView is also available.   To use this control type in your 
  42. application just include an IMPORTS statement in the app.DEF file for the 
  43. "PDSCNTL.ColorButtonWndFn" function.
  44.  
  45.  
  46. Default ColorButton parameter:
  47.  
  48.     BUTTON FACE       =  COLOR_BTNFACE    (usually gray)
  49.     BUTTON SHADOW     =  COLOR_BTNSHADOW  (usually dark gray)
  50.     BUTTON HILITE     =  WHITE_BRUSH
  51.     LABEL TEXT COLOR  =  COLOR_BTNTEXT    (usually black)
  52.     LABEL FONT        =  SYSTEM_FONT
  53.     LABEL STYLE       =  DT_CENTER | DT_WORDBREAK (see DrawText())
  54.  
  55.  
  56. The following is a summation of messages that can be sent to ColorButtons
  57.  
  58.  
  59.  
  60. CRBM_SETFACEBRUSH & CRBM_SETSHADOWBRUSH
  61. To Change: BUTTON COLOR
  62.  
  63.     Normally, when changing a button color, you should send messages to 
  64.     change both the BUTTON FACE and BUTTON SHADOW.  Your application must
  65.     create brushes for the colors to be used and pass the handle to the 
  66.     brush via the SendMessage().  
  67.  
  68.     SendMessage(hToColorButtonWnd, CRBM_SETFACEBRUSH, hYourFaceBrush, 0L); 
  69.     SendMessage(hToColorButtonWnd, CRBM_SETSHADOWBRUSH, hYourShadowBrush, 0L); 
  70.  
  71.     You may also reset the ColorButton to use the Default values with the 
  72.     following messages.
  73.  
  74.     SendMessage(hToColorButtonWnd, CRBM_SETFACEBRUSH, FALSE, 0L); 
  75.     SendMessage(hToColorButtonWnd, CRBM_SETSHADOWBRUSH, FALSE, 0L); 
  76.  
  77.     NOTE - do not DeleteObject() for hYourFaceBrush or hYourShadowBrush
  78.     prematurely as this will cause a failure in the ColorButton control
  79.     procedure.
  80.  
  81.  
  82. CRBM_SETTEXTCOLOR
  83. To Change: LABEL TEXT COLOR
  84.  
  85.     To change the color of the label text you will send the desire 
  86.     RGB value via the SendMessage().
  87.     
  88.     SendMessage(hToColorButtonWnd, CRBM_SETTEXTCOLOR, TRUE, crYourRGBValue); 
  89.  
  90.     To reset the color of the label text back to the default send the 
  91.     following:
  92.  
  93.     SendMessage(hToColorButtonWnd, CRBM_SETTEXTCOLOR, FALSE, 0L); 
  94.  
  95. CRBM_SETLABELFONT
  96. To Change: LABEL FONT
  97.  
  98.     To change the font for used for the label text, your application must
  99.     create a handle to the desired font then pass the handle to the 
  100.     font via the SendMessage().  
  101.  
  102.     SendMessage(hToColorButtonWnd, CRBM_SETLABELFONT, hYourFont, 0L); 
  103.  
  104.     You may also reset the ColorButton to use the Default font with the 
  105.     following message.
  106.  
  107.     SendMessage(hToColorButtonWnd, CRBM_SETLABELFONT, FALSE, 0L); 
  108.  
  109.     NOTE - do not DeleteObject() for hYourFont prematurely as this will 
  110.     cause a failure in the ColorButton control procedure.
  111.  
  112. CRBM_SETDRAWTEXTSTYLE
  113. To Change: LABEL STYLE
  114.  
  115.     The ColorButton control uses the DrawText function to create the label.
  116.     As a result, most of the style options that are available for this 
  117.     function are also available for use in this control.  When the control
  118.     is first created, the option of (DT_CENTER | DT_WORDBREAK) is
  119.     established.  You may replace this default value with the follow
  120.     SendMessage().
  121.  
  122.     SendMessage(hToColorButtonWnd, CRBM_SETDRAWTEXTSTYLE, wYourOption, 0L); 
  123.  
  124.     To reset to the default value:
  125.  
  126.     SendMessage(hToColorButtonWnd, CRBM_SETDRAWTEXTSTYLE, 
  127.                                        (DT_CENTER | DT_WORDBREAK), 0L); 
  128.  
  129.     NOTE - The ColorButton proc will cancel out the style option of 
  130.     DT_TABSTOP and DT_CALCRECT.  
  131.  
  132.  
  133. CRBM_GETFACEBRUSH & CRBM_GETSHADOWBRUSH
  134.  
  135. To Get: BUTTON COLOR
  136.  
  137.     lResult = SendMessage(hToColorButtonWnd, CRBM_GETFACEBRUSH, 0, 0L); 
  138.     lResult = SendMessage(hToColorButtonWnd, CRBM_GETSHADOWBRUSH, 0, 0L); 
  139.  
  140.     The value of LOWORD(lResult) contains the HBRUSH hBrushInUse.  This value
  141.     will be NULL if currently using the default control brush.
  142.  
  143. CRBM_GETTEXTCOLOR
  144.  
  145. To Get: LABEL TEXT COLOR
  146.  
  147.     lResult = SendMessage(hToColorButtonWnd, CRBM_GETTEXTCOLOR, 0, 0L); 
  148.     
  149.     The lResult value is the RGB color reference value currently in use
  150.     by the control.
  151.  
  152. CRBM_GETLABELFONT
  153. To Get: LABEL FONT
  154.  
  155.     lResult = SendMessage(hToColorButtonWnd, CRBM_GETLABELFONT, 0, 0L); 
  156.  
  157.     The value of LOWORD(lResult) contains the HFONT hFontInUse.  This value
  158.     will be NULL if currently using the default control font.
  159.  
  160. CRBM_GETDRAWTEXTSTYLE
  161. To Get: LABEL STYLE
  162.  
  163.     lResult = SendMessage(hToColorButtonWnd, CRBM_GETDRAWTEXTSTYLE, 0, 0L); 
  164.  
  165.     The value of LOWORD(lResult) contains the current DrawText styles for 
  166.     the control.
  167.  
  168.  
  169. Other Messages and Functions:
  170.  
  171.     This control will issue a WM_CTLCOLOR message to the parent window
  172.     during its paint procedure.  Like the same message for a standard     
  173.     windows button control, passing a brush handle as a return value
  174.     to this message has no affect.  However, any of the other control
  175.     messages could be sent prior to return of the WM_CTLCOLOR message.
  176.  
  177.     All of the window and dialog text functions and messages work as 
  178.     expected for this control; in as much as they function the same as 
  179.     they would with the standard windows push button.
  180.  
  181.  
  182.  
  183.